package com.redfootdev.horseskills;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;



public class HorseCommon {
// 
// getEntityFromUUID() - This finds the Entity based on its UUID. It checks 
//           		through each world and compares the UUID's of each 
//					entity until it finds a match
//
//		RETURNS - 	the entity if found, or null if the entity wasn't found.
//
	public Entity getEntityFromUUID (UUID uid) {
		List<World> worlds = Bukkit.getServer().getWorlds(); 
		for (World w: worlds) {
			List<Entity> entities = w.getEntities();
			for (Entity entity: entities) {
				if(entity.getUniqueId().equals(uid)){
					
					return entity;
				}
			}
		}
		return null;
	}
	
}